<?php
require_once("lib/curl.php");

//TODO rewrite these as methods and seperate the download from the parsing.

$prefix = "data/memberinfo-";

$member = "Oakie";

$ext = ".xml";

$desti = $prefix . $member . $ext;

// Download from 'example.com' to 'example.txt'
cURLdownload("http://www.wowarmory.com/character-sheet.xml?r=Shadowmoon&n=" . $member, $desti);
#echo phpinfo();

$xmlFileData = file_get_contents($desti);
$xmlData = new SimpleXMLElement($xmlFileData);
//And here's the output.

//print_r($xmlData);

//print ($xmlData->characterInfo->characterTab->items->item[0]['slot']);
foreach ($xmlData->characterInfo->characterTab->items->item as $item){
	print("Icon: " .  $item['icon'] . " Id: " . $item['id'] . "wowhead: " . "http://www.wowhead.com/?item=" . $item['id'] . "\r\n" );
	}

?>
